﻿@using Nightlife.Models
@model List<User>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

@if (Model == null || Model.Count == 0) {
<h3>Oops... something is terribly wrong here</h3>
} else {
<table>
    <thead>
        <tr>
            <th>Name</th>
            <th></th>
            <th></th>
        </tr>
    </thead>
    <tbody>
    @foreach (User user in Model) { 
        <tr>
            @user.Username
        </tr>
        <tr>
            @Html.ActionLink("View", "View", new { id=user.ID })
        </tr>
        <tr>
            @if (user.IsFriend(ViewBag.User)) {
                @Html.ActionLink("Add Friend", "AddFriend")
            } else {
                @Html.ActionLink("Delete Friend", "DeleteFriend")
            }
        </tr>
    }
    </tbody>
</table>
}